package com.yh.correct.service.impl;

import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yh.correct.dao.IRewordPunishMapper;
import com.yh.correct.model.Page;
import com.yh.correct.model.RewordPunish;
import com.yh.correct.service.IRewordPunishService;

/** 
* @author 刘文涛  E-mail: 894516860@qq.com
* @version 创建时间：2017年3月7日 下午 3:33:51
* 奖励惩罚记录业务层接口实现类
*/
@Service("rewordPunishService")
public class RewordPunishServiceImpl implements IRewordPunishService {
	
	@Autowired
	private IRewordPunishMapper rewordPunishMapper;
	
	@Override
	public Page getLikeRewordPunish(Map<String, Object> condition) {
		Page page=new Page();
		page.setTotalNum(rewordPunishMapper.getLikeRewordPunishCount(condition));
		int pageSize = Integer.parseInt(String.valueOf(condition.get("pageSize")));
		page.setPageSize(pageSize);
		int curPageNum = Integer.parseInt(String.valueOf(condition.get("pageNum")));
		page.setCurPageNum(curPageNum);
		page.setTotalPage(page.getTotalNum()/pageSize+(page.getTotalNum()%pageSize==0?0:1));
		page.setResult(rewordPunishMapper.getLikeRewordPunish(condition));
		return page;
	}

	@Override
	public int addRewordPunish(RewordPunish rewordpunish) {
		return rewordPunishMapper.addRewordPunish(rewordpunish);
	}

	@Override
	public int delRewordPunish(RewordPunish rewordpunish) {
		return rewordPunishMapper.delRewordPunish(rewordpunish);
	}

	@Override
	public int updateRewordPunish(RewordPunish rewordpunish) {
		return rewordPunishMapper.updateRewordPunish(rewordpunish);
	}

	@Override
	public Map<String, Object> getRewordPunishById(RewordPunish rewordpunish) {
		// TODO 自动生成的方法存根
		return rewordPunishMapper.getRewordPunishById(rewordpunish);
	}

	@Override
	public List<Map<String, Object>> getAllRewordPunish() {
		// TODO 自动生成的方法存根
		return rewordPunishMapper.getAllRewordPunish();
	}

}
